package com.hy.mvc.client.enumerate;

import java.util.HashMap;
import java.util.Map;

/**
 * @Desc
 * @Author Booker
 * @Date
 */
public enum DeptEnum {

    MANAGER("1", "管理层"),
    SALE("2", "销售部总监/经理"),
    RECEPTION("3", "前台"),
    RESERVE("4", "预订部"),
    FINANCE("5", "财务部"),
    IT("6", "IT技术部");
    public static Map<String, String> DEPT_MAP = new HashMap<>();

    static {
        for (DeptEnum entity : DeptEnum.values()) {
            DEPT_MAP.put(entity.getDeptId(), entity.getDeptName());
        }
    }

    private String deptId;
    private String deptName;


    DeptEnum(String deptId, String deptName) {
        this.deptId = deptId;
        this.deptName = deptName;
    }

    public static String getName(int code) {
        return DEPT_MAP.get(code);
    }

    public static DeptEnum valueOf(int code) {
        for (DeptEnum deptEnum : DeptEnum.values()) {
            if (deptEnum.getDeptId() == String.valueOf(code)) {
                return deptEnum;
            }
        }
        return null;
    }

    public String getDeptId() {
        return deptId;
    }

    public void setDeptId(String deptId) {
        this.deptId = deptId;
    }

    public String getDeptName() {
        return deptName;
    }

    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }
}
